const UNI_PLATFORM = process.env.UNI_PLATFORM;
const isH5 = UNI_PLATFORM === 'h5';

// 仅 H5 环境下自定义输出文件名
const config = isH5 ? {
  configureWebpack: {
    output: {
      filename: `static/js/[name].-V1.0.0-${Date.now()}.js`,
      chunkFilename: `static/js/[name].-V1.0.0-${Date.now()}.js`,
    },
  },
} : {};

// 可选：将版本号和时间戳注入环境变量（需配合 CSS 插件使用）
if (isH5) {
  process.env.VUE_APP_INDEX_CSS_HASH = `-V1.0.0-${Date.now()}`;
}

module.exports = config;